# print(time.time())
# net..configLinkStatus('r1', 'r2', 'down')
# net.configLinkStatus('r1', 'r4', 'down')
if True:
    n = 8
    isUp = True
    print(time.time())
    for i in range(n):
        if isUp:
            net.get('r1').cmd('ifconfig r1-eth0 down')
            isUp = False
        else:
            net.get('r1').cmd('ifconfig r1-eth0 up')
            isUp = True
        # if i == 0:
        #     # net.configLinkStatus('r1', 'r2', 'down')
        #     net.get('r1').cmd('ifconfig r1-eth0 down')
        # elif i == n - 1:
        #     # net.configLinkStatus('r1', 'r2', 'up')
        #     net.get('r1').cmd('ifconfig r1-eth0 up')
        # else:
        #     if isUp:
        #         # net.configLinkStatus('r1', 'r4', 'down')
        #         net.get('r1').cmd('ifconfig r1-eth1 down')
        #         isUp = False
        #     else:
        #         # net.configLinkStatus('r1', 'r4', 'up')
        #         net.get('r1').cmd('ifconfig r1-eth1 up')
        #         isUp = True
        #time.sleep(0.02)

